<template>
  <!--必听书单列表-->
<div style="height: 100%">
<headers heatle="必听书单"></headers>
  <div class="choiceness">
    <div class="recommend-content" v-for="i in bookdata"  @click="themeclick(i.themeid)">
      <img :src="URL + i.img">
      <div>
        <h6>{{i.title}}</h6>
        <p>{{i.contentabstract}}</p>
        <span>{{i.bookCount}}本书</span>
      </div>
    </div>
  </div>
</div>
</template>

<script>
  import headers from '@/components/headers'
    export default {
        name: "necessarily",
      data(){
          return{
            bookdata:[],
          }
      },
        components:{
          headers,
  },
      mounted(){
        let  date = new Date().getTime() //获取当前时间戳
        let obj ={page :1,rows:'10',timestamp:date,token :0,type:1}
        let sign =  this.md5(this.objKeySort(obj)+'44543e5367854cfcbb3a867f32fa64a2')//加密
        let url = 'https://testapi.readerday.com/v3/product/theme/list/0/' + sign +'/'+ date +'/1/10/1'
        this.$axios.get(url)
          .then((res)=>{
            this.bookdata=[]
            this.bookdata=res.data.data.list

            console.log(this.bookdata)
          })
      },
      methods:{
        themeclick(id){
          this.$router.push({name:'singlebook',params:{'id':id}})//调转详情页
        }
      }
    }
</script>

<style scoped>
  .choiceness{
    padding-top: .2rem;
    height: calc(100% - 56px) ;
    overflow-y: auto;
  }
  .choiceness h4{
    text-align: center;
    font-size: .14rem;
    line-height: .4rem;
  }
  .choiceness h4 span{
    float: right;
    margin-right: .1rem;
    color: #999;
    font-size: .12rem;
  }
  .recommend-content {
    height: .9rem;
    padding: 0 0.08rem;
  }
  .recommend-content img{
    float: left;
    height: 75px;
    width: 75px;
    margin-right: 10px;
  }
  .recommend-content div{
    float: left;
    text-align: left;
    width: calc(100% - 95px);
  }
  .recommend-content div h6{
    font-size: .14rem;
    height: .22rem;
    font-weight: bold;
  }
  .recommend-content div p{
    height: .34rem;
    font-size: .12rem;
    width: 100%;
  }
  .recommend-content div span{
    height: .15rem;
    line-height: .12rem;
    font-size: .12rem;
  }
</style>
